tekkitclassicfandomcom-20200214-history
Lua Tutorials
______________________________ Please add new tutorials in form of new pages to the Category Lua Tutorials instead! ______________________________ =Password Door= Creation If you place a computer on the right hand side of a door (Iron, Wooden or Reinforced), then input the following text. edit startup This opens up the page to edit what happens on the start up of the computer. Now type: print("Enter Password") In this code, you can change the text in the quotes to any text you want when the computer starts up Now press "Ctrl" then "Enter" to save it, then "Ctrl", "Right Arrow" then "Enter" to close the screen. Then type: edit bananas The word bananas can be substituted for any password but beware, it is case sensitive (e.g. "bananas" would not work with "Bananas"). Now type the following text into this menu. print("Password Accepted") print("Password Accepted") redstone.setOutput("left", true) sleep(3) redstone.setOutput("left", false) os.reboot() The previous script executes the following task After you have input this, press "Ctrl" then "Enter" to save it, then "Ctrl", "Right Arrow" then "Enter" to close the screen. Thief Proofing On a multiplayer server, you may want to do this if you want no one accessing you're door. To thief proof a computer you need to edit the file edit list Then input a print command of you're choice. E.g. print("No Hacking!!!") After you have input this, press "Ctrl" then "Enter" to save it, then "Ctrl", "Right Arrow" then "Enter" to close the screen. You also need to do the same for the program "Programs". E.g. edit programs Then input a print command of you're choice. E.g. print("No Hacking!!!") After you have input this, press "Ctrl" then "Enter" to save it, then "Ctrl", "Right Arrow" then "Enter" to close the screen. Additions print("Password Accepted") redstone.setOutput("left", true) sleep(3) redstone.setOutput("left", false) os.reboot() print("Password Accepted") redstone.setOutput("left", true) sleep(3) redstone.setOutput("left", false) os.reboot() This is the basic password door code. This section will teach you how to add on to that for any better reason. Aesthetics print("Password Accepted") sleep(1) print("Door Open. Please Proceed!") redstone.setOutput("left", true) sleep(3) redstone.setOutput("left", false) os.reboot() Adding the extra sleep(1) print("Door Open. Please Proceed!") Makes the operation look a lot better. Manual Override Adding a second password to keep the door open for as long as you like can help with boring tasks like building a second house and gathering the resources. To add the override, you have to input the text edit USA With "USA" being the example that you can change. Then input the text print("Override Accepted. Reboot To Reset!") redstone.setOutput("left", true) To reset the computer, simply press "Ctrl + R" Hacking This program is not very safe and easy to hack. First type this into the console: lua This will allow you to execute all codes, you can usually use in programs. Now remember the code to turn on redstone and type it in: redstone.setOutput("left", true) And there the door is opened without knowing any password. Preventing this hack This hack is easy to prevent with the method we uses before, just type this in: edit lua Now you can add the print text of your choice like already described above: print("Smart, but you failed!") All in all this way of making a door lock isn't very safe, because everyone could just start all of the not-denied programs, edit startup or use one of the other methods to bypass this lock. Category:ComputerCraft Category:Lua Tutorials